﻿
@using LERP.Web.App_Start
@using Sharp.Framework
@using Sharp.Framework.Extensions

@model List<LERP.Domain.GoodsCategory>
@{
    ViewBag.Title = "货品类别列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
 
@Html.ActionLinkEx("新建一级类别","Create", "GoodsCategory", new {  returnUrl = Request.RawUrl}, new {style="float: right;display: inline;"})
<br/>
<div id="treeDiv"  class="empty" style="text-align: left;">
        <ul class="jqueryFileTree">
    @foreach (var item in Model.Where(m=>m.Parent==null))
    {
        var list = Model.Where(x => x.Parent == item);
        <li class="directory collapsed">
           <span>  <a  class="treename">@item.DictionaryText   </a>
            @if (!list.Any())
            {
               @Html.ActionLinkEx("删除", "Delete", "GoodsCategory", new {id = item.Id, returnUrl = Request.RawUrl}, new {@class = "action delete"})
             }  
            @Html.ActionLinkEx("添加", "Create", "GoodsCategory", new {parentId = item.Id,level=1, returnUrl = Request.RawUrl}, new {@class = "action"})
            @Html.ActionLinkEx("修改", "Edit", "GoodsCategory", new {id = item.Id, returnUrl = Request.RawUrl}, new {@class = "action"}) </span>
            <ul class="jqueryFileTree">
                @foreach (var node in list)
                {

                    <li class="file ext_code">
                        <span><a  class="treename">@node.DictionaryText</a>
                        @Html.ActionLinkEx("删除", "Delete", "GoodsCategory", new {id = node.Id, returnUrl = Request.RawUrl}, new {@class = "action delete"}) 
                        @Html.ActionLinkEx("修改", "Edit", "GoodsCategory", new {id = node.Id, returnUrl = Request.RawUrl}, new {@class = "action",}) 
                     </span>
                    </li>
                }
    
            </ul>
        </li>

    }
</ul>
</div>
@section Scripts {  
    <script type="text/javascript">

        $(function () {
            $("a.delete").click(function () {
                return window.confirm("您确认要"+$(this).html()+"当前货品类别么?");

            }); 
            

        })

    </script>

}
